<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 *
 * @package    symfony
 * @subpackage plugin
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
 * @version    SVN: $Id: sfGuardUserPeer.php 7633 2008-02-27 17:54:50Z fabien $
 */
class sfGuardUserPeer extends PluginsfGuardUserPeer
{


   public static function retrieveByUsername($username, $isActive = true)
  {
    
    $wsdl = "http://localhost:8080/WebApplication/WebServiceClinique?wsdl";
    $options = array('compression' => true, 'exceptions' => false, 'trace' => true);

    $client = new SoapClient($wsdl, $options);
    $params = array ('username' => $username);
    $result = $client->Authentication($params);

    // Si le tableau est non vide
    if (!empty($result->return[0])){
       //Instanciation objet sfGuardUser
          //Instanciation objet sfGuardUser
         $user = new sfGuardUser();
        //Affecter les valeurs du tableau retourné par le webservice par les accesseurs
        $user->setId($result->return[0]);
        $user->setUsername($result->return[1]);
        $user->setAlgorithm($result->return[2]);
        $user->setSalt($result->return[3]);
        $user->setPasswordHash($result->return[4]);
        $user->setCreatedAt($result->return[5]);
        $user->setLastLogin($result->return[6]);
        $user->setIsActive($result->return[7]);
        $user->setIsSuperAdmin($result->return[8]);
        //$user->modifiedColumns[] = null;
    

        return $user;
    }

    return null;
    
  }
 


}
